<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Users extends Model
{
	//自定义属性
	protected $table = 'business';
	
	//注册
	public function getAdds($request)
	{
		$this->name = $request['name'];
		$this->phone = $request['phone'];
		$this->email = $request['email'];
		$this->pwd = Md5($request['pwd']);
		return $this->save();
	}
	
	//登录
	public static function getLogin($request)
	{
		$name = $request['name'];
		$pwd = $request['pwd'];
		return DB::table('business')->where('name',$name)->orWhere('pwd',$pwd)->first();
	}
}
